BSAVE Statement ---------------------------------------------------------------------------- Action Transfers the contents of an area of memory to an output file or device. Syntax BSAVE filespec$, offset%, length% Remarks The BSAVE statement uses the following arguments. ----------------------------------------------------------------------------- Argument Description ---------------------------------------------------------------------------- filespec$ A string expression that specifies the name of the file or device on which to save a memory-image file. offset% The offset of the starting address of the area in memory to be saved. length% The number of bytes to save. This is a numeric expression that returns an unsigned integer between 0 and 65,535, inclusive.- Argument Description ---------------------------------------------------------------------------- The BSAVE statement allows data or programs to be saved as memory-image files on disk. A memory-image file is a byte-for-byte copy of what is in memory along with control information used by BLOAD to load the file. The starting address of the area saved is determined by the offset and the most recent DEF SEG statement. Note Programs written in earlier versions of BASIC no longer work if they use VARPTR to access numeric arrays. Because different screen modes use memory differently, do not load graphic images in a screen mode other than the one used when they were created. If no DEF SEG statement is executed before the BSAVE statement, the program uses the default BASIC data segment (DGROUP). Otherwise, BSAVE begins saving at the address specified by the offset and by the segment set in the most recent DEF SEG statement. If the offset is a long integer, or single- or double-precision floating-point value, it is converted to an integer. If the offset is a negative number between -1 and -32,768, inclusive, it is treated as an unsigned 2-byte offset. BSAVE and Expanded Memory Arrays Do not use BSAVE to transfer an expanded memory array to an output file. (If you start QBX with the -Ea switch, any of these arrays may be stored in expanded memory. - Numeric arrays less than 16K in size. - Fixed-length string arrays less than 16K in size. - User-defined-type arrays less than 16K in size. If you want to use BSAVE to transfer an array to an output file, first start QBX without the -Ea switch. (Without the -Ea switch, no arrays are stored in expanded memory.) For more information on using expanded memory, see "Memory Management for QBX" in Getting Started. BASICA BSAVE does not support the cassette device. See Also BLOAD, DEF SEG Example The following example draws a magenta cube inside a white box and then uses BSAVE to store the drawing in the file MAGCUBE.GRH. The BLOAD statement programming example shows how you can retrieve and display the drawing after you create it. DIM Cube(1 TO 675) SCREEN 1 ' Draw a white box. LINE (140, 25)-(140 + 100, 125), 3, B ' Draw the outline of a magenta cube inside the box. DRAW "C2 BM140,50 M+50,-25 M+50,25 M-50,25" DRAW "M-50,-25 M+0,50 M+50,25 M+50,-25 M+0,-50 BM190,75 M+0,50" ' Save the drawing in the array Cube. GET (140, 25)-(240, 125), Cube ' Set segment to the array Cube's segment and store the drawing ' in the file MAGCUBE.GRH. Note. 2700 is the number of bytes ' in Cube (4 bytes per array element * 675). DEF SEG = VARSEG(Cube(1)) BSAVE "MAGCUBE.GRH", VARPTR(Cube(1)), 2700 DEF SEG ' Restore default BASIC segment.